﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MCTxtExport.aspx.cs" Inherits="OLPC_MCTxtExport" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxUploadControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.v11.1, Version=11.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxClasses" tagprefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ERP_导出</title>
    <link href="../Styles/main.css" rel="Stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../Jscript/common.js"></script>
    <script language="javascript" type="text/javascript">
        
        function showamount(strid, strvalue) {
            alert("in");
            alert("sss");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div id="headlocation" class="headlocation">
            <asp:Label ID="lblLocation" runat="server" Text="当前位置"></asp:Label>
            <img alt="当前位置" src="../Image/weizhi.gif" />>>
            <asp:Label ID="Label1" runat="server" Text="导出"></asp:Label>
        </div>   
        <div style="margin:15px 5px 10px 5px;">
        <asp:UpdatePanel ID="UpdatePanel" runat="server">
            <ContentTemplate>
                <asp:UpdateProgress ID="UpdateProgress3" runat="server">    
                    <ProgressTemplate>
                        <div class="transp" style="text-align:center; padding: auto auto;">
                        <span style="font-size:25px; color:Blue;">Data Loading..... </span></div>             
                    </ProgressTemplate>
                </asp:UpdateProgress>           
                <dx:ASPxPageControl ID="tc" runat="server" ActiveTabIndex="0" 
                    CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua"
                    SpriteCssFilePath="~/App_Themes/Aqua/{0}/sprite.css" TabSpacing="3px" 
                    Width="100%">
                    <TabPages>
                        <dx:TabPage Name="tabmcinformation" Text="已有收款导出">                       
                            <ContentCollection>
                                <dx:ContentControl ID="ContentControl2" runat="server">
                                    <dx:ASPxGridView ID="gv" ClientInstanceName="gv" Width="99%" KeyFieldName="AccountStatementItemCode"
                                        runat="server" AutoGenerateColumns="False" 
                                        OnAfterPerformCallback="gv_AfterPerformCallback" 
                                        OnCustomJSProperties="gv_CustomJSProperties" >
                                        <Columns>
                                            <dx:GridViewDataCheckColumn Width="50px" FixedStyle="Left">
                                                <HeaderTemplate>
                                                    <asp:CheckBox runat="server" AutoPostBack="true" Checked='<%# Checked1() %>' 
                                                    OnCheckedChanged="chk_Head_CheckedChange_gv" />                                                    
                                                </HeaderTemplate>
                                                <DataItemTemplate>
                                                    <asp:CheckBox 
                                                        runat="server" AutoPostBack="true"
                                                    Checked='<%# Checked(Convert.ToString(Eval("B1"))) %>'
                                                    ToolTip='<%# Eval("rowindex") %>' 
                                                    Enabled='<%# IsVisibale1(Convert.ToString(Eval("StateValue"))) %>'                              
                                                        OnCheckedChanged="chk_CheckedChanged_gv" />
                                                    <%--<input type="checkbox" runat="server" id="chk" name="ichk" onclick="importcheck(this.id);" value="sss"  />
                                                    <script language="javascript" type="text/javascript">
                                                            function importcheck(strid) {
                                                                alert("sfss");
//                                                              var v = document.getElementById(strid).value;
                                                                alert(strid);
                                                            }
                                                        </script>--%>
                                                </DataItemTemplate>
                                                <CellStyle HorizontalAlign="Center"></CellStyle>
                                                <HeaderStyle HorizontalAlign="Center" />
                                            </dx:GridViewDataCheckColumn>
                                            <dx:GridViewDataTextColumn Caption="状态" FieldName="StateText" Width="70px" FixedStyle="Left">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="手续费" 
                                                FieldName="HandlingFeeShowName" Width="55px" FixedStyle="Left">
                                                <Settings AutoFilterCondition="Equals" ShowFilterRowMenu="False" />
                                                <CellStyle HorizontalAlign="Center"></CellStyle>
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataColumn Caption="已承兑" FieldName="AcceptedShowName" 
                                                Width="45px" FixedStyle="Left">
                                                <Settings AutoFilterCondition="Equals" ShowFilterRowMenu="False" />                                                
                                                <CellStyle HorizontalAlign="Center"></CellStyle>
                                            </dx:GridViewDataColumn>
                                            <dx:GridViewDataTextColumn Caption="批号" FieldName="AccountStatementCode" 
                                                Width="120px" Visible="false">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="添加人" FieldName="showname" 
                                                Width="150px">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataDateColumn Caption="添加时间" FieldName="ADDDATE" 
                                                Width="150px" UnboundType="DateTime">
                                                <PropertiesDateEdit DisplayFormatString="{0:yyyy-MM-dd HH:mm}" 
                                                    EditFormat="DateTime">
                                                    <CalendarProperties ClearButtonText="清空" TodayButtonText="今天">
                                                    </CalendarProperties>
                                                </PropertiesDateEdit>
                                            </dx:GridViewDataDateColumn>
                                            <dx:GridViewDataTextColumn Caption="银行参考号" FieldName="BankReference" 
                                                Width="150px" FixedStyle="Left">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="客户参考号" FieldName="CustomerReference" 
                                                Visible="False">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataDateColumn Caption="起息日" FieldName="ValueDate" 
                                                Width="150px" UnboundType="DateTime">
                                                <PropertiesDateEdit DisplayFormatString="{0:yyyy-MM-dd}"></PropertiesDateEdit>
                                            </dx:GridViewDataDateColumn>
                                            <dx:GridViewDataDateColumn Caption="入账日期" FieldName="EntryDate" 
                                                Width="140px" UnboundType="DateTime">
                                                <PropertiesDateEdit DisplayFormatString="{0:yyyy-MM-dd}"></PropertiesDateEdit>
                                            </dx:GridViewDataDateColumn>
                                            <dx:GridViewDataTextColumn Caption="交易金额" FieldName="TransactionAmount" 
                                                Width="120px" FixedStyle="Left" UnboundType="Decimal">
                                                <Settings AutoFilterCondition="GreaterOrEqual" />
                                                <PropertiesTextEdit DisplayFormatString="{0:N2}" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="已分配金额" FieldName="AppliedAmount" 
                                                Width="120px" FixedStyle="Left" UnboundType="Decimal">
                                                <Settings AutoFilterCondition="GreaterOrEqual" />
                                                <PropertiesTextEdit DisplayFormatString="{0:N2}" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="剩余金额" FieldName="TransactionAmountLeft" 
                                                Width="120px" FixedStyle="Left" UnboundType="Decimal">
                                                <Settings AutoFilterCondition="GreaterOrEqual" />
                                                <PropertiesTextEdit DisplayFormatString="{0:N2}" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="币 种" FieldName="Currency" 
                                                Width="100px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="产品类型" FieldName="ProductType" Width="160px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="交易说明" FieldName="TransactionDescription" 
                                                Width="160px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="额外信息" FieldName="ExtraInformation" 
                                                Width="240px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="汇款人/开票人名称" FieldName="OrderingPartyName" 
                                                Width="240px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="汇款人/开票人账户" FieldName="OrderingPartyAccount" 
                                                Width="200px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="定购方银行名称" FieldName="OrderingPartyBankName" 
                                                Width="300px">
                                            </dx:GridViewDataTextColumn>                                        
                                            <dx:GridViewDataTextColumn Caption="付款细节" FieldName="PaymentDetails" 
                                                Width="220px">
                                            </dx:GridViewDataTextColumn> 
                                            <dx:GridViewDataTextColumn Caption="收款方式" FieldName="AccountsReceivable" Width="220px">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="客户编号" FieldName="CustomerCode" 
                                                Width="90px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="客户名称" FieldName="CustomerName" 
                                                Width="200px">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="出票行" FieldName="MOLine" Width="140px" Visible="false">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="出票人" FieldName="MOPerson" Width="160px">
                                                <Settings AutoFilterCondition="Contains" />
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataDateColumn Caption="到期日" FieldName="MaturityDate" 
                                                Width="160px" UnboundType="DateTime">
                                                <PropertiesDateEdit DisplayFormatString="{0:yyyy-MM-dd}"></PropertiesDateEdit>
                                            </dx:GridViewDataDateColumn>
                                            <dx:GridViewDataTextColumn Caption="公司" FieldName="CoName" Width="250px">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="状态值" FieldName="StateValue" Visible="false">
                                            </dx:GridViewDataTextColumn>
                                            <dx:GridViewDataTextColumn Caption="rowindex" FieldName="rowindex" Visible="false">
                                            </dx:GridViewDataTextColumn>
                                        </Columns>
                                        <SettingsBehavior ColumnResizeMode="Control" AllowFocusedRow="True" 
                                            AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True"></SettingsBehavior>
                                        <Settings ShowFilterRow="True" ShowGroupPanel="True"  ShowFilterRowMenu="true"
                                            ShowHorizontalScrollBar="True" VerticalScrollableHeight="22">
                                        </Settings>
                                        <Styles>
                                            <Header Font-Bold="True">
                                            </Header>
                                            <AlternatingRow Enabled="True">
                                            </AlternatingRow>
                                        </Styles>
                                    </dx:ASPxGridView>
                                    <div style="padding:5px 0 5px 100px; font-size: 18px; font-weight: bold;">
                                        <asp:Label runat="server" ID="Label2" Text="已选金额："></asp:Label>
                                        <asp:Label runat="server" ID="lblSelectedAmountImport" Text='0'></asp:Label>
                                    </div>  
                                    <div style="margin:25px 0 20px 0; text-align:center;">
                                        <asp:Button ID="btnmcexport" runat="server" Text="确 定" CssClass="cmdStyle"
                                            OnClientClick="return confirm('确定导出？')" onclick="btnsure_Click" />
                                    </div>                
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                        <dx:TabPage Name="tabmcinformation" Text="已匹配收款导出">                       
                            <ContentCollection>
                                <dx:ContentControl ID="ContentControl1" runat="server">
                                    <div style="padding:5px 10px 5px 10px;">
                                        <dx:ASPxGridView ID="gvAssigned" Width="100%" runat="server" 
                                            AutoGenerateColumns="False" 
                                            OnAfterPerformCallback="gvAssigned_AfterPerformCallback">
                                            <Columns>
                                                <dx:GridViewDataCheckColumn Width="50px" FixedStyle="Left">
                                                    <HeaderTemplate>
                                                        <asp:CheckBox runat="server" OnCheckedChanged="chk_Head_CheckedChanged" AutoPostBack="true"
                                                        Checked='<%# Checked2() %>' />
                                                    </HeaderTemplate>
                                                    <DataItemTemplate>
                                                        <asp:CheckBox runat="server" AutoPostBack="true"
                                                        Checked='<%# Checked(Convert.ToString(Eval("B1"))) %>'
                                                        ToolTip='<%# Eval("rowindex") %>' 
                                                        Enabled='<%# IsVisibale2(Convert.ToString(Eval("StateValue"))) %>'                              
                                                            OnCheckedChanged="chk_CheckedChanged" />
                                                    </DataItemTemplate>
                                                    <CellStyle HorizontalAlign="Center"></CellStyle>
                                                    <HeaderStyle HorizontalAlign="Center" />
                                                    <PropertiesCheckEdit DisplayTextChecked="是" DisplayTextUnchecked="否">
                                                    </PropertiesCheckEdit>
                                                </dx:GridViewDataCheckColumn>
                                                <dx:GridViewDataTextColumn Caption="状态" FieldName="StateText" Width="80px" FixedStyle="Left">
                                                </dx:GridViewDataTextColumn><dx:GridViewDataTextColumn Caption="银行参考号" FieldName="BankReference" 
                                                    Width="140px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="交易金额" FieldName="TransactionAmount" 
                                                    Width="110px" UnboundType="Decimal">
                                                    <Settings AutoFilterCondition="GreaterOrEqual" />
                                                    <PropertiesTextEdit DisplayFormatString="{0:N2}" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="合同号" FieldName="ContractNo" 
                                                    Width="140px" FixedStyle="Left">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="Order NO" FieldName="SalesOrderNo" 
                                                    Width="140px" FixedStyle="Left">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="匹配金额" FieldName="ApplyAmount"
                                                 Width="110px" FixedStyle="Left" UnboundType="Decimal">
                                                    <Settings AutoFilterCondition="GreaterOrEqual" />
                                                    <PropertiesTextEdit DisplayFormatString="{0:N2}" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="InvoiceNO(订单)" FieldName="InvioceNo" 
                                                    Width="140px" FixedStyle="Left">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="InvoiceNO(Advance)" FieldName="InvoiceNo" 
                                                    Width="140px" FixedStyle="Left">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="收款类型" FieldName="CollectionType" Width="160px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="匹配人" FieldName="showname" Width="160px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataDateColumn Caption="匹配时间" FieldName="UPDATEDATE" Width="140px" 
                                                    FixedStyle="Left" UnboundType="DateTime">
                                                    <PropertiesDateEdit DisplayFormatString="{0:yyyy-MM-dd HH:mm}" 
                                                        EditFormat="DateTime">
                                                        <CalendarProperties ClearButtonText="清空" TodayButtonText="今天">
                                                        </CalendarProperties>
                                                    </PropertiesDateEdit>
                                                </dx:GridViewDataDateColumn>
                                                <dx:GridViewDataTextColumn Caption="客户编号" FieldName="CustomerCode" Width="100px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="客户" FieldName="Customer" Width="160px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="销售员" FieldName="Salesman" Width="140px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="CE" FieldName="CEName" Width="140px">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="订单金额" FieldName="SalesOrderAmountVAT" 
                                                    Width="110px" UnboundType="Decimal">
                                                    <Settings AutoFilterCondition="GreaterOrEqual" />
                                                    <PropertiesTextEdit DisplayFormatString="{0:N2}" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="收款比例(%)" FieldName="APSOA" Width="80px" UnboundType="DateTime">
                                                    <Settings AutoFilterCondition="GreaterOrEqual" />
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="rowindex" FieldName="rowindex" Visible="false">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="公司" FieldName="CoName" Width="250px">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            <SettingsBehavior ColumnResizeMode="Control"></SettingsBehavior>
                                            <Settings ShowFilterRow="True" ShowFilterRowMenu="true"
                                            ShowHorizontalScrollBar="True" VerticalScrollableHeight="22">
                                            </Settings>
                                        </dx:ASPxGridView>
                                    </div>
                                    <div style="padding:5px 0 5px 100px; font-size: 18px; font-weight: bold;">
                                        <asp:Label runat="server" ID="Label3" Text="已选匹配金额："></asp:Label>
                                        <asp:Label runat="server" ID="lblSelectedAmountAssigned"></asp:Label>
                                    </div>      
                                    <div style="margin:25px 0 20px 0; text-align:center;">
                                        <asp:Button ID="btnsure" runat="server" Text="确 定" CssClass="cmdStyle"
                                            OnClientClick="return confirm('确定导出？')" onclick="btnsure_Click" />
                                    </div>                
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                        <dx:TabPage Name="tabmcinformation" Text="生成的*.txt">                       
                            <ContentCollection>
                                <dx:ContentControl ID="ContentControl3" runat="server">
                                    <div style="margin:35px 0 0 0;">
                                        <div style="margin:5px 0 15px 45px; font-size: 18px; font-weight: bold;">*.txt 列表</div>
                                        <div style="padding:5px 0 15px 75px; font-size: 22px; font-weight: bold;">                                        
                                            <%= getUserCode() %>
                                        </div>
                                    </div>
                                </dx:ContentControl>
                            </ContentCollection>
                        </dx:TabPage>
                    </TabPages>
                    <Paddings Padding="2px" PaddingLeft="5px" PaddingRight="5px"></Paddings>
                    <ContentStyle>
                        <Border BorderColor="#AECAF0" BorderStyle="Solid" BorderWidth="1px" />
                    </ContentStyle>
                </dx:ASPxPageControl>
                <asp:HiddenField ID="hidHandlingFee" runat="server" Value="0" />  
                <asp:HiddenField ID="hidfirstflag" runat="server" Value="0" />      
                <asp:HiddenField ID="hidbank" runat="server" Value="0" />   
                <asp:HiddenField ID="hidimporthead" runat="server" Value="0" />
                <asp:HiddenField ID="hidassignedhead" runat="server" Value="0" />
                <script language="javascript" type="text/javascript">
                    function pagereload(url, errormessage) {
                        alert(url);
                        window.open(url, 'filedownload',
                         'status=no,menubar=no,top=0,left=0,width=10,height=10,resizable=yes,scrollbars=yes');
                        if (errormessage != null && errormessage.toString().length > 0) {
                            alert(errormessage);
                        }
                    }
                </script>                              
            </ContentTemplate>
            <Triggers>
                <%--<asp:PostBackTrigger ControlID="tc$btnload" />
                <asp:PostBackTrigger ControlID="tc$btnImportAdd" />
                <asp:PostBackTrigger ControlID="tc$btnImportedExport" />
                <asp:PostBackTrigger ControlID="tc$btnImportingExport" />--%>
                <asp:PostBackTrigger ControlID="tc$btnmcexport" />
                <asp:PostBackTrigger ControlID="tc$btnsure" />
            </Triggers>
        </asp:UpdatePanel>
        </div>
    </form>
</body>
</html>
